<?php
if (!defined("BASEPATH")) exit("No direct script access allowed");

class Html_model extends MY_Model {

	function __construct() {
		parent::__construct();
		$this->tableName = "html";
		$this->prefix = "html";
	}

	function getHtmlByBookie($bookieName, $sportId, $id = null) {
		$this->db->select("html_id, html_sport_id, html_type, html_text");
		$this->db->from($this->tableName);
		$this->db->join("bookie", "bookie.bookie_id = ".$this->tableName.".html_bookie_id and bookie_del = 0 and bookie_name = '".$this->db->escape_str($bookieName)."'");
		$this->db->where("html_del", 0);
		$this->db->where("html_sport_id", $sportId);
		if(!is_null($id)) {
			$this->db->where("html_id", $id);
		}
		//$this->db->limit(10);
		$result = $this->db->get();
		//Common::pr($this->db->last_query()); exit;
		if($result->num_rows()) {
			return ($result->result_array());
		}
		return array();
	}
   
}